﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ThridGroup.ERP.DTO;
using ThridGroup.ERP.DTO.WarehouseManagement;

namespace ThridGroup.ERP.WarehouseManagement
{  

    /// <summary>
    /// 销售退货接口
    /// </summary>
    public interface  ISalesReturnsServices
    {
         
        /// <summary>
        /// 添加销售退货
        /// </summary>
        /// <param name="salesReturnsDTO"></param>
        /// <returns></returns>
        Task<int> AddSalesReturns(CreSalesReturnsDto salesReturnsDTO);

        Task<List<CustomerDTO>> ShowCustomer(int pageIndex = 1, int pageSize = 10, string? customerName = "");

        /// <summary>
        /// 获取所有仓库设置
        /// </summary>
        Task<List<WarehouseSettingDto>> GetWarehouseSettings();
        /// <summary>
        /// 分页获取仓库设置
        /// </summary>
        Task<(List<WarehouseSettingDto> data, int total)> GetWarehouseSettingsPaged(
            string depotCode = null,
            string depotName = null,
            string location = null,
            int page = 1,
            int limit = 10);

        /// <summary>
        /// 分页查询销售退货单，支持退货单编号、销售订单编号、客户名称、仓库名称的模糊查询，以及单据状态的等值查询
        /// </summary>
        /// <param name="returnNumber">退货单编号（模糊查询）</param>
        /// <param name="salesOrdersCode">销售订单编号（模糊查询）</param>
        /// <param name="customeName">客户名称（模糊查询）</param>
        /// <param name="returnsWarehouse">仓库名称（模糊查询）</param>
        /// <param name="documentStatus">单据状态（等值查询）</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">每页数量</param>
        /// <returns>退货单列表及总数</returns>
        Task<(List<SalesReturnsListDto> data, int total)> GetSalesReturnsPaged(string returnNumber = null, string salesOrdersCode = null, string customeName = null, string returnsWarehouse = null, int? documentStatus = null, int pageIndex = 1, int pageSize = 10);

        /// <summary>
        /// 删除单个退货单
        /// </summary>
        Task DeleteAsync(int id);

        /// <summary>
        /// 批量删除退货单
        /// </summary>
        Task BatchDeleteAsync(List<int> ids);

        /// <summary>
        /// 根据ID获取退货单详情（用于反填）
        /// </summary>
        Task<CreSalesReturnsDto> GetByIdAsync(int id);

        /// <summary>
        /// 修改退货单
        /// </summary>
        Task UpdateAsync(CreSalesReturnsDto dto);

        /// <summary>
        /// 修改退货单状态（如将草稿改为完成）
        /// </summary>
        Task UpdateStatusAsync(int id, int documentStatus);

    }
}
